import pygame
from pygame.locals import *

class About:
	def __init__(self, game_app, py_screen):
		print "about create"
		self.screen = py_screen
		self.ws = game_app
		self.ws.SetArrowCursor()
		self.about_caption = self.ws.test_font.render("This is About", False, (255,255,255))
		self.windows_bgcolor = (0,0,0)#(63,127,63)
		self.mouse_pos = (0,0)
		self.menu_exit_over = pygame.image.load("data/graphics/buttons/back_btn_over.png")#self.ws.test_font.render("Exit",False,(64,64,64))
		self.menu_exit_up = pygame.image.load("data/graphics/buttons/back_btn_up.png")
		self.menu_exit = self.menu_exit_up
		self.menu_exit_rect = pygame.Rect(290,425, self.menu_exit.get_width(), self.menu_exit.get_height());
		self.menu_exit_is_over = False
		
	def Update(self):
		for event in pygame.event.get():
			if event.type == QUIT:
				self.ws.mainLoop = False
			if event.type == MOUSEBUTTONUP:
				m_pos = event.pos
				if self.menu_exit_rect.collidepoint(m_pos):
					self.ws.SetCurrentScene(2)

		self.mouse_pos = pygame.mouse.get_pos()
		
		if self.menu_exit_rect.collidepoint(self.mouse_pos):
			if not self.menu_exit_is_over:
				self.menu_exit_is_over = True
				self.ws.SetOverCursor()
				self.menu_exit = self.menu_exit_over
		elif self.menu_exit_is_over:
			self.menu_exit_is_over = False
			self.ws.SetArrowCursor()
			self.menu_exit = self.menu_exit_up
		
		self.screen.fill(self.windows_bgcolor)
		
		#pygame.draw.circle(self.screen, (127,63,127), self.mouse_pos, 20)
		self.screen.blit(self.about_caption, (290,50))
		#pygame.draw.rect(self.screen, (128,128,128), self.menu_exit_rect)
		self.screen.blit(self.menu_exit, self.menu_exit_rect.topleft)
		
		pygame.display.update()